package com.xiaoyu.awakening.gateway.handler;

import com.xiaoyu.awakening.gateway.dto.TokenLoginValidateDto;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * token 基础处理类
 *
 * @author wangxiaoyu
 * @since v1.0
 */
public abstract class AbstractTokenVerifyHandler {
    /**
     * 调用验证判断
     *
     * @author wangxiaoyu
     * @since v1.0
     */
    public abstract boolean needVerify();

    /**
     * 处理顺序，倒序处理
     *
     * @author wangxiaoyu
     * @since v1.0
     */
    public abstract int order();

    /**
     * 验证逻辑
     *
     * @author wangxiaoyu
     * @since v1.0
     */
    public abstract Mono<TokenLoginValidateDto> verify(ServerWebExchange exchange, GatewayFilterChain chain);
}
